//
//  AppDelegate.m
//  HundPark
//
//  Created by Aguilar Rolando on 2013-03-04.
//  Copyright (c) 2013 ARV IT. All rights reserved.
//

#import "AppDelegate.h"

@implementation AppDelegate
@synthesize allParks = _allParks;

//Lazy Instantiation
-(City *)allParks
{
    if(!_allParks)
        _allParks = [[City alloc] init];
    
    return _allParks;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //Load from NSUserDeafults
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *UUIDString = [defaults objectForKey:@"appUUIDKey"];
    
    //Check if previousliy saved
    if(UUIDString ==0)
    {
        //Create new appUUID
        id appIdObject = [NSUUID UUID];
        NSString *appIdString = [appIdObject UUIDString];
        
        //Save into NSUserDeaults
        [defaults setObject:appIdString forKey:@"appUUIDKey"];
        [defaults synchronize];
        
    }
    
    // Override point for customization after application launch.
    return YES;
}

@end
